Skip to content

chore: add change to stop retrying m365 504 errors#1510

Open
m0nggh wants to merge 2 commits intodevelop-v2from
chore/m365-excel/format-504-errors
Open

chore: add change to stop retrying m365 504 errors#1510
m0nggh wants to merge 2 commits intodevelop-v2from
chore/m365-excel/format-504-errors

Conversation

@m0nggh
Copy link
Copy Markdown
Contributor

@m0nggh m0nggh commented Mar 30, 2026

Problem

Felt like there's no need to retry 504 timeout errors especially most of the times its just long running formulas.
I realise that power automate has the same issue and they just let the execution run for 15 mins and then it fails as a gateway timeout issue similar to us.

Solution

Temporary fix:

  • Format 504 errors as a StepError and give the exact solution to update their excel file instead of praying that they look at our guide or they will end up sending in a ticket to Plumber support

What changed

  • request-error-handler.ts — new handle504 that branches on test vs live run:
    • Test run → fails immediately with StepError ("Excel request timed out... long-running formulas")
    • Live run → throws RetriableError with errorCode: EXCEL_504_ERROR_CODE
  • retriable-error.ts — added optional errorCode field to carry custom retry identity
  • handle-failed-step-and-throw.ts — new ERROR_CODE_MAX_ATTEMPTS map (EXCEL_504 → 3), and handleRetriableError now uses it to cap retries per error code

Before & After Screenshots

BEFORE:
image

AFTER:
image

Tests

Create an excel file with long running formulas -- i can pass you a file if needed
Before publishing the pipe

  1. Set the excel file calculation options to be Automatic
  2. Try creating an excel row in test step and it should give that new formatted error
  3. Set the excel file calculation options to be Manual, wait for 5-10 minutes if necessary
  4. Try creating an excel row in test step and it should not have any error

Publish the pipe and test live executions

  1. Publish the pipe and test a live execution (should succeed)
  2. Set the calculation options back to Automatic
  3. Test another live execution and the new formatted error should appear and auto-retry should be done
  • 504 on attempt 1, 2 → job retries (RetriableError rethrown)
  • 504 on attempt 3 → job stops with UnrecoverableError, error message from RetriableError is preserved in errorDetails
  1. Test that you can retry the failed execution and it should still fail
  2. Then set the calculation options back to Manual
  3. Test that you can retry the failed execution and it should now succeed

Regression:

  • Other 5xx errors (500, 502, 503) → unaffected, still use their existing handlers
  • Non-m365 apps with step-type RetriableError → now capped at MAXIMUM_JOB_ATTEMPTS (new behaviour — verify this is safe)
  • Warning log fires on 504 with event: 'm365-http-504'

@m0nggh m0nggh requested a review from a team as a code owner March 30, 2026 02:36
@pregnantboy
Copy link
Copy Markdown
Contributor

could we set the retries to 3

@m0nggh m0nggh force-pushed the chore/m365-excel/format-504-errors branch from c44ec4d to 64e0807 Compare April 14, 2026 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants